package com.koron.order.repair.bean.vo;

import com.koron.order.common.bean.po.OrderEquipPo;
import com.koron.order.common.bean.po.OrderInstructionBean;
import com.koron.order.common.bean.po.OrderLocationPo;
import com.koron.order.repair.bean.entity.RepairEquipmentPo;
import com.koron.order.repair.bean.entity.RepairPo;
import com.koron.order.repair.bean.entity.RepairReadyPo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName MaintainDetailVo
 * @description
 * @Author zhouj
 * @Date 2021/9/22 16:18
 */
@Data
@ApiModel("计划检修工单_详情Vo")
public class RepairDetailVo extends RepairPo {

    @ApiModelProperty(value = "计划检修工单_作业准备")
    private List<RepairReadyPo> repairReadyPoList;

    @ApiModelProperty(value = "计划检修工单_作业过程")
    private List<RepairEquipmentPo> repairEquipmentPoList;

    @ApiModelProperty(value = "计划检修工单_作业指导书")
    private List<OrderInstructionBean> orderInstructionBeanList;

    @ApiModelProperty(value = "基础信息的设备列表")
    private List<OrderEquipPo> orderEquipPoList;

    @ApiModelProperty(value = "是否提交")
    private Boolean isCommit = false;

    @ApiModelProperty(value = "工单工作地点信息")
    private List<OrderLocationPo> orderLocationList;

    @ApiModelProperty(value = "是否有权限保存、提交;规则：草稿只能由创建人保存、提交。")
    private boolean hasSubmitPermission;

    public List<OrderLocationPo> getOrderLocationList() {
        if (CollectionUtils.isEmpty(orderLocationList)) {
            return new ArrayList<>();
        }
        return orderLocationList;
    }

}
